<!DOCTYPE html>
<html>

<head>
    <title>工艺地球</title>
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="custom/images/favicon.ico?v=2" />
    <style>
        html,
        body {
            padding: 0px;
            margin: 0px;
        }
    </style>
    <script src="../libs/jquery-3.4.1.min.js"></script>
    <script src='../libs/message.js'></script>
    <script src='../custom/configs/htconfig.js'></script>
    <script src='../custom/libs/echarts.js'></script>
    <script src='../libs/core/ht.js'></script>
    <script src='../libs/core/ht-ui.js'></script>
    <script src='../libs/plugin/ht-edgetype.js'></script>
    <script src='../libs/plugin/ht-obj.js'></script>
    <script src='../libs/plugin/ht-form.js'></script>
    <script src='../libs/plugin/ht-vector.js'></script>
    <script src="../conf/confURL.js"></script>
    <script src='../conf/dateTime.js'></script>

    <script>
        //获取url
        var url = domain + "/HT_DATA_EIGHT.getGlobalStatistics.do";
        //获取图纸
        var dataModel = new ht.DataModel();
        var graphView = new ht.graph.GraphView(dataModel);
        //定义标签
        var warn = [];
        //饼图
        var per = [];
        let pie = [];
        var perp = [];
        var piep = [];
        let H = [];
        var botton = [];
        var echartsArr = [];
        var echart = [];
        function init() {
            graphView.addToDOM();
            ht.Default.xhrLoad('displays/智慧兴达/兴达八厂/工艺监控/process_earth.json', function (text) {
                var json = ht.Default.parse(text);
                if (json.title) document.title = json.title;
                dataModel.deserialize(json);
                graphView.fitContent(true);
                tag();
                getData1();
                getData2("year");
                getData3();
                getData4("heat");
                getData5();
                getData6("year");
                getData7();
                getData8();
                getData9();
                //年月监听事件
                graphView.addInteractorListener(function (e) {
                    if (e.kind === 'clickData') {
                        if (e.data._tag == 'botton1') {
                            getData2("year")
                            botton[0].a("xs", true);
                            botton[1].a("xs", false);
                        }
                        else if (e.data._tag == 'botton2') {
                            getData2("month")
                            botton[0].a("xs", false);
                            botton[1].a("xs", true);
                        }
                        else if (e.data._tag == 'botton3') {
                            getData4("heat")
                            botton[2].a("xs", true);
                            botton[3].a("xs", false);
                        }
                        else if (e.data._tag == 'botton4') {
                            getData4("wet")
                            botton[2].a("xs", false);
                            botton[3].a("xs", true);
                        }
                        else if (e.data._tag == 'botton5') {
                            getData6("year")
                            botton[4].a("xs", true);
                            botton[5].a("xs", false);
                        }
                        else if (e.data._tag == 'botton6') {
                            getData6("month")
                            botton[4].a("xs", false);
                            botton[5].a("xs", true);
                        }
                    }
                });
            });
            //更新数据
            // setInterval(function(){getData(), getData2(), getData3()}, 1000 * 60 * 30);
            // setInterval(function(){getData4(),getData5()},1000 * 60 *5);
            //时间日期
            setInterval(function () {
                let dateTime = dataModel.getDataByTag('dateTime');
                let time = updateTime();
                dateTime.a('time', time);
            }, 1000);
        }
        function tag() {
            for (let i = 1; i < 4; i++) {
                echartsArr.push(dataModel.getDataByTag("echart" + i)); //折线图
            }
            for (let i = 1; i < 4; i++) {                           //菜单 折线图
                echart.push(dataModel.getDataByTag("echart_" + i));
            }
            for (let i = 1; i < 7; i++) {
                botton.push(dataModel.getDataByTag("botton" + i));   // 按钮
            }
            for (let i = 1; i < 15; i++) {                        //报表文本
                H.push(dataModel.getDataByTag("H" + i));
            }
            for (let i = 1; i < 15; i++) {
                warn.push(dataModel.getDataByTag("warn" + i));//权限
            }
            for (let i = 1; i < 5; i++) {
                per.push(dataModel.getDataByTag("per" + i));  //饼图框
            }
            for (let i = 1; i < 5; i++) {
                pie.push(dataModel.getDataByTag("pie" + i)); //饼图
            }
            for (let i = 1; i < 5; i++) {
                perp.push(dataModel.getDataByTag("per_" + i));//菜单 饼图框
            }
            for (let i = 1; i < 5; i++) {
                piep.push(dataModel.getDataByTag("pie_" + i));//菜单 饼图
            }
        }
        //盘条库存
        function getData1() {
            const pos1 = dataModel.getDataByTag('pos1');
            const pos2 = dataModel.getDataByTag('pos2');
            const pos3 = dataModel.getDataByTag('pos3');
            const pos_1 = dataModel.getDataByTag('pos_1');
            const pos_2 = dataModel.getDataByTag('pos_2');
            const pos_3 = dataModel.getDataByTag('pos_3');
            var repData = {};
            $.ajax({
                type: "POST",
                url: url,
                data: { props: "HT_GY_DQ_REPORT_PTKCTJ" },
                headers: request_headers,
                async: true,
                // contentType: 'application/x-www-form-urlencoded',
                success: function (res) {
                    var repData = JSON.parse(res);
                    if (repData._MSG_ === 'OK' && repData.HT_GY_DQ_REPORT_PTKCTJ.visible == "true") {
                        H[0].s("text", repData.HT_GY_DQ_REPORT_PTKCTJ.title);
                        H[7].s("text", repData.HT_GY_DQ_REPORT_PTKCTJ.title);
                        warn[0].s("2d.visible", false);
                        warn[7].s("2d.visible", false);
                        pos1.s("2d.visible", true);
                        pos2.s("2d.visible", true);
                        pos3.s("2d.visible", true);
                        pos_1.s("2d.visible", true);
                        pos_2.s("2d.visible", true);
                        pos_3.s("2d.visible", true);
                        pos1.a("textone", repData.HT_GY_DQ_REPORT_PTKCTJ.data[0].title);
                        pos1.a("num", repData.HT_GY_DQ_REPORT_PTKCTJ.data[0].sore);
                        pos2.a("textone", repData.HT_GY_DQ_REPORT_PTKCTJ.data[1].title);
                        pos2.a("num", repData.HT_GY_DQ_REPORT_PTKCTJ.data[1].sore);
                        pos3.a("textone", repData.HT_GY_DQ_REPORT_PTKCTJ.data[2].title);
                        pos3.a("num", repData.HT_GY_DQ_REPORT_PTKCTJ.data[2].sore);
                        pos_1.a("textone", repData.HT_GY_DQ_REPORT_PTKCTJ.data[0].title);
                        pos_1.a("num", repData.HT_GY_DQ_REPORT_PTKCTJ.data[0].sore);
                        pos_2.a("textone", repData.HT_GY_DQ_REPORT_PTKCTJ.data[1].title);
                        pos_2.a("num", repData.HT_GY_DQ_REPORT_PTKCTJ.data[1].sore);
                        pos_3.a("textone", repData.HT_GY_DQ_REPORT_PTKCTJ.data[2].title);
                        pos_3.a("num", repData.HT_GY_DQ_REPORT_PTKCTJ.data[2].sore);
                    } else {
                        warn[0].s("2d.visible", true);
                        warn[7].s("2d.visible", true);
                        pos1.s("2d.visible", false);
                        pos2.s("2d.visible", false);
                        pos3.s("2d.visible", false);
                        pos_1.s("2d.visible", false);
                        pos_2.s("2d.visible", false);
                        pos_3.s("2d.visible", true);
                    }
                },
                error: function (error) {
                    warn[0].s("2d.visible", true);
                    warn[7].s("2d.visible", true);
                    pos1.s("2d.visible", false);
                    pos2.s("2d.visible", false);
                    pos3.s("2d.visible", false);
                    pos_1.s("2d.visible", false);
                    pos_2.s("2d.visible", false);
                    pos_3.s("2d.visible", true);
                }
            })
            return repData
        }
        //模具模耗
        function getData2(ny) {
            const take3 = dataModel.getDataByTag("take3");
            const take_3 = dataModel.getDataByTag("take_3");
            var repData = {};
            $.ajax({
                type: "POST",
                url: url,
                data: {
                    props: "HT_GY_DQ_REPORT_MJMHTJ",
                    mark: ny
                },
                headers: request_headers,
                async: true,
                contentType: 'application/x-www-form-urlencoded',
                success: function (res) {
                    var repData = JSON.parse(res);
                    if (repData._MSG_ === 'OK' && repData.HT_GY_DQ_REPORT_MJMHTJ.visible == "true") {
                        H[1].s("text", repData.HT_GY_DQ_REPORT_MJMHTJ.title);
                        H[8].s("text", repData.HT_GY_DQ_REPORT_MJMHTJ.title);
                        warn[1].s("2d.visible", false);
                        warn[8].s("2d.visible", false);
                        take3.s("2d.visible", true);
                        take_3.s("2d.visible", true);
                        echartsArr[0].a("xData", repData.HT_GY_DQ_REPORT_MJMHTJ.data.xdata);
                        echartsArr[0].a("data1", repData.HT_GY_DQ_REPORT_MJMHTJ.data.jsxd);
                        echartsArr[0].a("data2", repData.HT_GY_DQ_REPORT_MJMHTJ.data.sdxd);
                        echartsArr[0].a("data3", repData.HT_GY_DQ_REPORT_MJMHTJ.data.dgxd);
                        echart[0].a("xdata", repData.HT_GY_DQ_REPORT_MJMHTJ.data.xdata);
                        echart[0].a("data1", repData.HT_GY_DQ_REPORT_MJMHTJ.data.jsxd);
                        echart[0].a("data2", repData.HT_GY_DQ_REPORT_MJMHTJ.data.sdxd);
                        echart[0].a("data3", repData.HT_GY_DQ_REPORT_MJMHTJ.data.dgxd);
                    } else {
                        warn[1].s("2d.visible", true);
                        warn[8].s("2d.visible", true);
                        take3.s("2d.visible", false);
                        take_3.s("2d.visible", false);
                    }
                },
                error: function (error) {
                    warn[1].s("2d.visible", true);
                    warn[8].s("2d.visible", true);
                    take3.s("2d.visible", false);
                    take_3.s("2d.visible", false);
                }
            })
            return repData
        }
        //盘条投用占比 
        function getData3() {
            const take1 = dataModel.getDataByTag("take1");
            const take_1 = dataModel.getDataByTag("take_1");
            var repData = {};
            $.ajax({
                type: "POST",
                url: url,
                data: { props: "HT_GY_DQ_REPORT_PTTYZB01TJ" },
                headers: request_headers,
                async: true,
                contentType: 'application/x-www-form-urlencoded',
                success: function (res) {
                    var repData = JSON.parse(res);
                    if (repData._MSG_ === 'OK' && repData.HT_GY_DQ_REPORT_PTTYZB01TJ.visible == "true") {
                        H[2].s("text", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.title);
                        H[9].s("text", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.title);
                        warn[2].s("2d.visible", false);
                        warn[9].s("2d.visible", false);
                        take1.s("2d.visible", true);
                        take_1.s("2d.visible", true);
                        pie[0].a("num", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.data[0].num);
                        pie[1].a("num", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.data[1].num);
                        per[0].a("text", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.data[0].total);
                        per[1].a("text", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.data[1].jiangSu);
                        piep[0].a("num", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.data[0].num);
                        piep[1].a("num", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.data[1].num);
                        perp[0].a("text", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.data[0].total);
                        perp[1].a("text", repData.HT_GY_DQ_REPORT_PTTYZB01TJ.data[1].jiangSu);
                    } else {
                        warn[2].s("2d.visible", true);
                        warn[9].s("2d.visible", true);
                        take1.s("2d.visible", false);
                        take_1.s("2d.visible", false);
                    }
                },
                error: function (error) {
                    warn[2].s("2d.visible", true);
                    warn[9].s("2d.visible", true);
                    take1.s("2d.visible", false);
                    take_1.s("2d.visible", false);
                }
            })
            return repData
        }
        //CPK≥1.33占比
        function getData4(hw) {
            const take4 = dataModel.getDataByTag("take4")
            const take_4 = dataModel.getDataByTag("take_4")
            var repData = {};
            $.ajax({
                type: "POST",
                url: url,
                data: {
                    props: "HT_GY_DQ_REPORT_CPKZBTJ",
                    mark: hw
                },
                headers: request_headers,
                async: true,
                //contentType: 'application/x-www-form-urlencoded',
                success: function (res) {
                    var repData = JSON.parse(res);
                    if (repData._MSG_ === 'OK' && repData.HT_GY_DQ_REPORT_CPKZBTJ.visible == "true") {
                        H[3].s("text", repData.HT_GY_DQ_REPORT_CPKZBTJ.title);
                        H[10].s("text", repData.HT_GY_DQ_REPORT_CPKZBTJ.title);
                        warn[3].s("2d.visible", false);
                        warn[10].s("2d.visible", false);
                        take4.s("2d.visible", true);
                        take_4.s("2d.visible", true);
                        echartsArr[1].a("xAxis", repData.HT_GY_DQ_REPORT_CPKZBTJ.data.xdata);
                        echartsArr[1].a("yAxis1", repData.HT_GY_DQ_REPORT_CPKZBTJ.data.jiangsu);
                        echartsArr[1].a("yAxis2", repData.HT_GY_DQ_REPORT_CPKZBTJ.data.shandong);
                        echartsArr[1].a("yAxis3", repData.HT_GY_DQ_REPORT_CPKZBTJ.data.taiguo);
                        echart[1].a("xAxis", repData.HT_GY_DQ_REPORT_CPKZBTJ.data.xdata);
                        echart[1].a("yAxis1", repData.HT_GY_DQ_REPORT_CPKZBTJ.data.jiangsu);
                        echart[1].a("yAxis2", repData.HT_GY_DQ_REPORT_CPKZBTJ.data.shandong);
                        echart[1].a("yAxis3", repData.HT_GY_DQ_REPORT_CPKZBTJ.data.taiguo);
                    } else {
                        warn[3].s("2d.visible", true);
                        warn[10].s("2d.visible", true);
                        take4.s("2d.visible", false);
                        take_4.s("2d.visible", false);
                    }
                },
                error: function (error) {
                    warn[3].s("2d.visible", true);
                    warn[10].s("2d.visible", true);
                    take4.s("2d.visible", false);
                    take_4.s("2d.visible", false);
                }
            })
            return repData
        }
        //吨平断丝
        let table
        let table_1
        function getData5() {
            table = dataModel.getDataByTag('table');
            table_1 = dataModel.getDataByTag('table_1');
            var repData = {};
            $.ajax({
                type: "POST",
                url: url,
                data: { props: "HT_GY_DQ_REPORT_DPDS01TJ" },
                headers: request_headers,
                async: true,
                contentType: 'application/x-www-form-urlencoded',
                success: function (res) {
                    var repData = JSON.parse(res);
                    if (repData._MSG_ === 'OK' && repData.HT_GY_DQ_REPORT_DPDS01TJ.visible == "true") {
                        H[4].s("text", repData.HT_GY_DQ_REPORT_DPDS01TJ.title);
                        H[11].s("text", repData.HT_GY_DQ_REPORT_DPDS01TJ.title);
                        warn[4].s("2d.visible", false);
                        warn[11].s("2d.visible", false);
                        table.s("2d.visible", true);
                        table_1.s("2d.visible", true);
                        table.a("num", repData.HT_GY_DQ_REPORT_DPDS01TJ.data.num);
                        table.a("gg", repData.HT_GY_DQ_REPORT_DPDS01TJ.data.guige);
                        table_1.a("num", repData.HT_GY_DQ_REPORT_DPDS01TJ.data.num);
                        table_1.a("gg", repData.HT_GY_DQ_REPORT_DPDS01TJ.data.guige);
                    } else {
                        warn[4].s("2d.visible", true);
                        warn[11].s("2d.visible", true);
                        table.s("2d.visible", false);
                        table_1.s("2d.visible", false);
                    }
                },
                error: function (error) {
                    warn[4].s("2d.visible", true);
                    warn[11].s("2d.visible", true);
                    table.s("2d.visible", false);
                    table_1.s("2d.visible", false);
                }
            })
            return repData
        };
        //吨平断丝
        function getData6(ny) {
            const take5 = dataModel.getDataByTag("take5");
            const take_5 = dataModel.getDataByTag("take_5");
            var repData = {};
            $.ajax({
                type: "POST",
                url: url,
                data: {
                    props: "HT_GY_DQ_REPORT_DPDS02TJ",
                    mark: ny
                },
                headers: request_headers,
                async: true,
                contentType: 'application/x-www-form-urlencoded',
                success: function (res) {
                    var repData = JSON.parse(res);
                    if (repData._MSG_ === 'OK' && repData.HT_GY_DQ_REPORT_DPDS02TJ.visible == "true") {
                        H[5].s("text", repData.HT_GY_DQ_REPORT_DPDS02TJ.title);
                        H[12].s("text", repData.HT_GY_DQ_REPORT_DPDS02TJ.title);
                        warn[5].s("2d.visible", false);
                        warn[12].s("2d.visible", false);
                        take5.s("2d.visible", true);
                        take_5.s("2d.visible", true);
                        echartsArr[2].a("xData", repData.HT_GY_DQ_REPORT_DPDS02TJ.data.xdata);
                        echartsArr[2].a("data1", repData.HT_GY_DQ_REPORT_DPDS02TJ.data.jiangsu);
                        echartsArr[2].a("data2", repData.HT_GY_DQ_REPORT_DPDS02TJ.data.shandong);
                        echartsArr[2].a("data3", repData.HT_GY_DQ_REPORT_DPDS02TJ.data.taiguo);
                        echart[2].a("xData", repData.HT_GY_DQ_REPORT_DPDS02TJ.data.xdata);
                        echart[2].a("data1", repData.HT_GY_DQ_REPORT_DPDS02TJ.data.jiangsu);
                        echart[2].a("data2", repData.HT_GY_DQ_REPORT_DPDS02TJ.data.shandong);
                        echart[2].a("data3", repData.HT_GY_DQ_REPORT_DPDS02TJ.data.taiguo);
                    } else {
                        warn[5].s("2d.visible", true);
                        warn[12].s("2d.visible", true);
                        take5.s("2d.visible", false);
                        take_5.s("2d.visible", false);
                    }
                },
                error: function (error) {
                    warn[5].s("2d.visible", true);
                    warn[12].s("2d.visible", true);
                    take5.s("2d.visible", false);
                    take_5.s("2d.visible", false);
                }
            })
            return repData
        }
        //盘条投用占比
        function getData7() {
            let take2 = dataModel.getDataByTag("take2")
            let take_2 = dataModel.getDataByTag("take_2")
            var repData = {};
            $.ajax({
                type: "POST",
                url: url,
                data: { props: "HT_GY_DQ_REPORT_PTTYZB02TJ" },
                headers: request_headers,
                async: true,
                contentType: 'application/x-www-form-urlencoded',
                success: function (res) {
                    var repData = JSON.parse(res);
                    if (repData._MSG_ === 'OK' && repData.HT_GY_DQ_REPORT_PTTYZB02TJ.visible == "true") {
                        H[6].s("text", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.title);
                        H[13].s("text", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.title);
                        warn[6].s("2d.visible", false);
                        warn[13].s("2d.visible", false);
                        take2.s("2d.visible", true);
                        take_2.s("2d.visible", true);
                        pie[2].a("num", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.data[0].num);
                        pie[3].a("num", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.data[1].num);
                        per[2].a("text", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.data[0].shanDong);
                        per[3].a("text", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.data[1].taiGuo);
                        piep[2].a("num", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.data[0].num);
                        piep[3].a("num", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.data[1].num);
                        perp[2].a("text", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.data[0].shanDong);
                        perp[3].a("text", repData.HT_GY_DQ_REPORT_PTTYZB02TJ.data[1].taiGuo);
                    } else {
                        warn[6].s("2d.visible", true);
                        warn[13].s("2d.visible", true);
                        take2.s("2d.visible", false);
                        take_2.s("2d.visible", false);
                    }
                },
                error: function (error) {
                    warn[6].s("2d.visible", true);
                    warn[13].s("2d.visible", true);
                    take2.s("2d.visible", false);
                    take_2.s("2d.visible", false);
                }
            })
            return repData
        }
        //菜单树接口

        function getData8() {
            const treeNode = dataModel.getDataByTag("treeNode")
            const tree = dataModel.getDataByTag("tree")
            var repData = {};
            $.ajax({
                type: "POST",
                url: url,
                data: { props: "HT_GY_ZZ_TREE" },
                headers: request_headers,
                async: true,
                contentType: 'application/x-www-form-urlencoded',
                success: function (res) {
                    var repData = JSON.parse(res,handleJson);
                    if (repData._MSG_ === 'OK' && repData.visible === true) {
                        treeNode.s("2d.selectable", true);
                        tree.a("ht.dataSource", repData.HT_GY_ZZ_TREE);
                    } else {
                        treeNode.s("2d.selectable", false);
                    }
                },
                error: function (error) {
                    treeNode.s("2d.selectable", false);
                }
            })
            return repData
        }
        //地图跳转地址 
        function getData9() {
            const shandong = dataModel.getDataByTag('shandong');
            const jiangsu = dataModel.getDataByTag('jiangsu');
            const taiguo = dataModel.getDataByTag('taiguo');
            var repData = {};
            $.ajax({
                type: "POST",
                url: url,
                data: { props: "HT_GY_ZZ_MAP_LINK" },
                headers: request_headers,
                async: true,
                contentType: 'application/x-www-form-urlencoded',
                success: function (res) {
                    var repData = JSON.parse(res);
                    if (repData._MSG_ === 'OK' && repData.HT_GY_ZZ_MAP_LINK.visible == "true") {
                        jiangsu.s("label", repData.HT_GY_ZZ_MAP_LINK.data);
                        shandong.s("label", repData.HT_GY_ZZ_MAP_LINK.data);
                        taiguo.s("label", repData.HT_GY_ZZ_MAP_LINK.data);
                    }
                },
                error: function (error) {
                    // console.log('err');
                }
            })
        }

    </script>
</head>

<body onload='setTimeout(init, 300)'>
</body>

</html>